#!/usr/bin/env bash
# Copyright 2016 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
MAKE=make
case `uname` in
Linux)
    N=`cat /proc/cpuinfo | grep processor | wc -l`
    PARALLEL=-j`expr $N + $N`
    ;;
Darwin)
    PARALLEL=-j`sysctl -n hw.ncpu`
    ;;
FreeBSD)
    PARALLEL=-j`sysctl -n hw.ncpu`
    MAKE=gmake
    ;;
*)
    PARALLEL=-j8
    ;;
esac
exec $MAKE $PARALLEL "$@"
